﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

namespace RTS
{
	public class RTSTrainingBuildingTexture : RTSBuildingTextures
	{
		private string spawning = "BarracksSpriteSheetSPAWNING";

		private Dictionary<Type, string> queueNames = new Dictionary<Type, string>();
		private Dictionary<Type, Texture2D> queueTextures = new Dictionary<Type, Texture2D>();

		public string Spawning
		{
			set { spawning = value; }
		}

		public RTSTrainingBuildingTexture(TextureSize textureSize)
			: base(textureSize)
		{
			
		}

		public void AddTrainingUnit(Type unitClass, string textureName)
		{
			queueNames[unitClass] = textureName;
		}

		public override void LoadContent(ContentManager Content)
		{
			foreach (KeyValuePair<Type, string> queueName in queueNames)
			{
				queueTextures[queueName.Key] = Content.Load<Texture2D>(queueName.Value);
			}

			LoadTexture(Building.Spawning, spawning, Content);

			base.LoadContent(Content);
		}

		public Texture2D GetQueueTexture(Type unitclass)
		{
			if (texturesLoaded == false) Trace.WriteLine("Error GetQueueTexture RTSTrainingBuildingsTextures");

			return queueTextures[unitclass];
		}
	}
}
